<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/element.css" rel="stylesheet"/>
    <link href="../css/styleindex.css" rel="stylesheet"/>
    <style>
    .el-input__inner{
      border: 0;
      font-size: 1rem;
      text-align: center;
    }.el-input__prefix{
      display: none;
    }
    </style>
</head>
<body style="background:#EFF0F4;">

  <div class="mui-content">
    <div id="vm" class="x-examok" v-cloak>
      <div class="x-header-g" id="header">
        <a class="x-header-arrow" @click="api.closeWin()"></a>
        <div class="x-header-t">工作台-记录顾客反馈</div>
      </div>
      <!--  -->
      <div class="x-ico-month">
        <el-date-picker v-model="cardsmonth" type="month" placeholder="选择月" @change="getmonth" format="yyyy 年 MM 月" value-format="yyyyMM" :editable="notkey"></el-date-picker>
      </div>
      <!--  -->
      <div class="x-ut-box">
        <div class="x-ut-bot">
          <template>
            <el-table :data="tableData"  @cell-click='goincardlist'>
              <el-table-column label="序号" width="50" type="index" fixed></el-table-column>
              <el-table-column label="类别" width="" fixed>
                <template slot-scope="scope">
                  {{scope.row.cate_title}}
                </template>
              </el-table-column>
              <el-table-column label="方式" width="">
                <template slot-scope="scope">
                  {{scope.row.type_title}}
                </template>
              </el-table-column>
              <el-table-column label="创建时间" width="60">
                <template slot-scope="scope">
                  {{scope.row.date}}
                </template>
              </el-table-column>
              <el-table-column label="详细内容" width="">
                <el-button type="text">查看</el-button>
              </el-table-column>
            </el-table>
          </template>
        </div>
      </div>
      <!--  -->
      <div class="x-pro-gobtn" @click="api.openWin({name:'addcustomerfeed',url:'addcustomerfeed.html'})">填写新反馈</div>
    </div>
  </div>

  <script type="text/javascript" src="../script/vue.js"></script>
  <script type="text/javascript" src="../script/element.js"></script>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/base.js"></script>
	<script>
apiready = function () {
    $api.fixStatusBar($api.byId('header'));
    api.addEventListener({
        name: 'addcustomerfeedok'
    }, function(ret, err) {
        vm.getdata()
    });
    //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
          cardsmonth:'',
          tableData:[],
          personnum:'',
          notkey:false,

        }
      },
      created:function() {
        var that=this;


      },
      mounted:function(){
        var that=this;

        //当前月份
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth()+1;
        console.log(month);
        if(month<10){
          month = '' + 0 + month;
        }
        console.log(month);
        var toMonth = '' + year + month ;
        console.log('time:'+toMonth);
        this.cardsmonth = toMonth;
        that.getdata()
      },
      methods: {
        //
        getdata:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/duty/getFeedbackList',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.cardsmonth
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.tableData = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //
        getmonth:function(val){
          var that = this;
          console.log(val);
          // console.log(val.getMonth()+1);
          // var tmon = val.getMonth()+1
          // if(tmon<10){
          //   tmon=''+0+tmon
          // }
          // console.log(''+val.getFullYear() + tmon);
          that.cardsmonth = val;
          that.getdata()

        },
        //查看
        goincardlist:function(val){
          var that=this;
          console.log(JSON.stringify(val));
          api.openWin({
              name: 'addcustomerfeed',
              url: './addcustomerfeed.html',
              pageParam: {
                  onlyseeid:val.id
              }
          });
        },
      }
    })
	}


	</script>
</body>
</html>
